//
//  ContactViewController.m
//  搭建框架(代码已封装)
//
//  Created by My Mac on 2017/1/25.
//  Copyright © 2017年 My Mac. All rights reserved.
//

#import "ContactViewController.h"
#import "LeftMenuView.h"
#import "MenuView.h"
@interface ContactViewController ()

@property (nonatomic ,strong)MenuView *menu;
@end

@implementation ContactViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initSwipe];
    
    

}

#pragma mark - 初始化手势
-(void)initSwipe
{
    //创建轻扫手势
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)];
    //设置该手势处理器处理几个手指的轻扫手势（默认为1）
    swipe.numberOfTouchesRequired = 1;
    //设置该手势的处理方向
    swipe.direction = UISwipeGestureRecognizerDirectionRight;
    //为视图添加手势
    [self.view addGestureRecognizer:swipe];
}
-(void)handleSwipe:(UISwipeGestureRecognizer *)sender
{
    UISwipeGestureRecognizer *swipe = sender;
    if (swipe.direction == UISwipeGestureRecognizerDirectionRight) {
        //设置弹出视图的大小
        LeftMenuView *demo = [[LeftMenuView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width * 0.66, [[UIScreen mainScreen] bounds].size.height)];
        //协议的代理者
        //菜单视图与视图的依赖
        MenuView *menu = [MenuView MenuViewWithDependencyView:self.view MenuView:demo isShowCoverView:YES];
        self.menu = menu;
        [self.menu show];
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
